package com.example.demo.client;

import java.io.Serializable;

/**
 * 请求业务接口的配置
 *
 * @author tyh
 * @date 2018/11/1
 */
public final class OpenParameters implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用于标识请求方法
     */
    private String apiName;
    /**
     * 用于标识请求接口
     */
    private String apiCode;
    /**
     * 用于标识请求模块
     */
    private String moduleCode;
    /**
     * 用于标识服务版本号
     */
    private String apiVersion;
    /**
     * 客户端流水号client_serial_no
     */
    private String serialNo;
    /**
     * 用户id
     */
    private String userId;
    /**
     * 请求报文
     */
    private String param;

    private OpenParameters(Builder builder) {
        this.apiName = builder.apiName;
        this.apiCode = builder.apiCode;
        this.moduleCode = builder.moduleCode;
        this.apiVersion = builder.apiVersion;
        this.userId = builder.userId;
        this.param = builder.param;
        this.serialNo = builder.serialNo;
    }

    public String getApiName() {
        return apiName;
    }

    public String getApiCode() {
        return apiCode;
    }

    public String getModuleCode() {
        return moduleCode;
    }

    public String getApiVersion() {
        return apiVersion;
    }

    public String getUserId() {
        return userId;
    }

    public String getParam() {
        return param;
    }

    public String getSerialNo() {
        return serialNo;
    }

    /**
     * builder for all our params
     */
    public static class Builder {
        private String apiName;
        private String apiCode;
        private String moduleCode;
        private String apiVersion;
        private String userId;
        private String param;
        private String serialNo;

        public Builder() {
            // empty
        }

        public Builder apiName(String apiName) {
            this.apiName = apiName;
            return this;
        }

        public Builder apiCode(String apiCode) {
            this.apiCode = apiCode;
            return this;
        }

        public Builder moduleCode(String moduleCode) {
            this.moduleCode = moduleCode;
            return this;
        }

        public Builder apiVersion(String apiVersion) {
            this.apiVersion = apiVersion;
            return this;
        }

        public Builder userId(String userId) {
            this.userId = userId;
            return this;
        }

        public Builder param(String param) {
            this.param = param;
            return this;
        }

        public Builder serialNo(String serialNo) {
            this.serialNo = serialNo;
            return this;
        }

        public OpenParameters build() {
            return new OpenParameters(this);
        }
    }

}
